package br.jm.mala.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

/**
 *
 * @author joao
 */
@Entity
@Table(name = "modulos", catalog = "mala", schema = "dbo")
public class Modulos implements Serializable {

    private static final long serialVersionUID = 8238111478336611096L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "modulo_id")
    private Integer moduloId;
    @Column(name = "description")
    private String description;
    @Column(name = "dsc_modulo")
    private String dscModulo;
    @Column(name = "num_nivel")
    private Integer numNivel;
    @Column(name = "ordem", length = 1)
    private String ordem;
    @Column(name = "menu", length = 3)
    private String menu;

    @Transient
    private String dscMenu;

    @Transient
    private Boolean incluir;
    @Transient
    private Boolean alterar;
    @Transient
    private Boolean excluir;
    @Transient
    private Boolean consultar;

    public Integer getModuloId() {
        return moduloId;
    }

    public void setModuloId(Integer modulo_id) {
        this.moduloId = modulo_id;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Modulos() {
    }

    public String getDscModulo() {
        return dscModulo;
    }

    public void setDscModulo(String dscModulo) {
        this.dscModulo = dscModulo;
    }

    public Integer getNumNivel() {
        return numNivel;
    }

    public void setNumNivel(Integer numNivel) {
        this.numNivel = numNivel;
    }

    public String getOrdem() {
        return ordem;
    }

    public void setOrdem(String ordem) {
        this.ordem = ordem;
    }

    public String getDscMenu() {
        if (this.ordem == null) {
            this.dscMenu = "Acesso Menu";
        } else if (this.ordem.equals("X")) {
            this.dscMenu = "Acesso Menu";
        } else if (this.ordem.equals("B")) {
            this.dscMenu = "Acesso Sub-Menu";
        } else if (this.ordem.equals("C")) {
            this.dscMenu = "Acesso Modulo";
        } else if (this.ordem.equals("A")) {
            this.dscMenu = "Acesso Modulo";
        }
        return dscMenu;
    }

    public void setDscMenu(String dscMenu) {
        this.dscMenu = dscMenu;
    }

    public String getMenu() {
        return menu;
    }

    public void setMenu(String menu) {
        this.menu = menu;
    }

    public Boolean getIncluir() {
        return incluir;
    }

    public void setIncluir(Boolean incluir) {
        this.incluir = incluir;
    }

    public Boolean getAlterar() {
        return alterar;
    }

    public void setAlterar(Boolean alterar) {
        this.alterar = alterar;
    }

    public Boolean getExcluir() {
        return excluir;
    }

    public void setExcluir(Boolean excluir) {
        this.excluir = excluir;
    }

    public Boolean getConsultar() {
        return consultar;
    }

    public void setConsultar(Boolean consultar) {
        this.consultar = consultar;
    }
/*
    @Override
    public int compareTo(Modulos modulos) {
        int result = numNivel.compareTo(modulos.numNivel);
        return result == 0 ? ordem.compareTo(((Modulos) modulos).ordem) : result;
    }
    */
}
